﻿using System.Drawing;

using ExplorerGame.Gameboard.Elements;

namespace ExplorerGame.Graphics
{
    internal class GameboardGraphics
    {
        internal void DrawGameboardElement(System.Drawing.Graphics graphics, GameboardElement gameboardElement, int x, int y, int width, int height, bool heroOnElement)
        {
            graphics.DrawRectangle(Pens.Black, new Rectangle(x, y, width, height));

            Brush targetBrush;

            if (gameboardElement is GameboardElementPlains)
            {
                targetBrush = Brushes.Green;
            }
            else if (gameboardElement is GameboardElementForest)
            {
                targetBrush = Brushes.DarkGreen;
            }
            else if (gameboardElement is GameboardElementHills)
            {
                targetBrush = Brushes.LightGreen;
            }
            else if (gameboardElement is GameboardElementLake)
            {
                targetBrush = Brushes.Blue;
            }
            else
            {
                targetBrush = Brushes.Black;
            }

            graphics.FillRectangle(targetBrush, new Rectangle(x + 1, y + 1, width - 1, height - 1));

            if (heroOnElement)
            {
                graphics.DrawRectangle(Pens.Gold, new Rectangle(x + 1, y + 1, width - 2, height - 2));
                graphics.DrawRectangle(Pens.Gold, new Rectangle(x + 2, y + 2, width - 4, height - 4));
            }
        }
    }
}
